<!-- $Id: goods_info.htm 17126 2010-04-23 10:30:26Z liuhui $ -->

{include file="pageheader.htm"}

{insert_scripts files="../js/utils.js,selectzone.js,colorselector.js,../js/region.js"}

<script language="javascript" type="text/javascript" src="../js/DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="../js/jquery1.42.min.js"></script>


{if $warning}

<ul style="padding:0; margin: 0; list-style-type:none; color: #CC0000;">

  <li style="border: 1px solid #CC0000; background: #FFFFCC; padding: 10px; margin-bottom: 5px;" >{$warning}</li>

</ul>

{/if}

<!-- start goods form -->

<div class="tab-div">

    <!-- tab bar -->

    <div id="tabbar-div">

      <p>

        <span class="tab-front" id="general-tab">{$lang.tab_general}</span><span

        class="tab-back" id="detail-tab">{$lang.tab_detail}</span><span

        class="tab-back" id="mix-tab">{$lang.tab_mix}</span>{if $goods_type_list}<span

        class="tab-back" id="properties-tab">{$lang.tab_properties}</span>{/if}<span

        class="tab-back" id="gallery-tab">{$lang.tab_gallery}</span><!--<span

        class="tab-back" id="linkgoods-tab">{$lang.tab_linkgoods}</span>{if $code eq ''}<span

        class="tab-back" id="groupgoods-tab">{$lang.tab_groupgoods}</span>{/if}<span

        class="tab-back" id="article-tab">{$lang.tab_article}</span>-->

      </p>

    </div>

    <!-- tab body -->

    <div id="tabbody-div">

      <form enctype="multipart/form-data" action="" method="post" name="theForm" onsubmit="return validate('{$goods.goods_id}')">

        <!-- 鏈€澶ф枃浠堕檺鍒 -->

        <input type="hidden" name="MAX_FILE_SIZE" value="2097152" />

        <!-- 閫氱敤淇℃伅 -->

        

        <table width="100%" id="general-table" align="center">

          <tr>

            <td class="label">{$lang.lab_goods_name}</td>

            <td><input type="text" name="goods_name" value="{$goods.goods_name|escape}" style="float:left;color:{$goods_name_color};" size="30" />&nbsp;{$lang.require_field}

            </td>

          </tr>

          <tr>

            <td class="label">商品简单描述：</td>

            <td><textarea name="goods_brief" id="goods_brief" cols="35" rows="2">{$goods.goods_brief}</textarea></td>

          </tr>          

          <tr>

            <td class="label">显示区域：</td>

            <td>   <select name="city_id" id="selCities"  onchange="region.changed(this, 3, 'selDistricts')">

          <option value='1'>全国</option>

            {foreach from=$cities item=region}

              <option value="{$region.region_id}" {if $region.region_id eq $goods.city_id}selected="selected"{/if}>{$region.region_name}</option>

            {/foreach}



        </select>

         <select name="district_id" id="selDistricts">



        <option value="0">请选择</option>



        {foreach from=$district_list item=district}



        <option value="{$district.region_id}" {if $district.region_id eq $goods.district_id}selected="selected"{/if}  >{$district.region_name}</option>



        {/foreach}



    </select> </td>

          </tr>

          <tr>

            <td class="label">

            {$lang.lab_goods_sn} </td>

            <td><input type="text" name="goods_sn" value="{$goods.goods_sn|escape}" size="20" onblur="checkGoodsSn(this.value,'{$goods.goods_id}')" /><span id="goods_sn_notice"></span>

            <span class="notice-span" id="noticeGoodsSN">{$lang.notice_goods_sn}</span></td>

          </tr>

            <tr>

            <td class="label">规格：</td>

            <td><input type="text" name="guige" id="guige" value="{$goods.guige}"  /></td>

          </tr>

          <tr>

            <td class="label">{$lang.lab_goods_cat}</td>

            <td><select name="cat_id" onchange="hideCatDiv()" ><option value="0">{$lang.select_please}</option>{$cat_list}</select>

               {$lang.require_field}

            </td>
           <tr>
            <td class="label">{$lang.lab_goods_brand}</td>
            <td><select name="brand_id"  ><option value="0">{$lang.select_please}{html_options options=$brand_list selected=$goods.brand_id}</select>
			
            </td>
          </tr>
          </tr>

                {if $suppliers_exists eq 1}

          <tr>

            <td class="label">选择商家：</td>

            <td><select name="suppliers_id" id="suppliers_id">

        <option value="0">不选择商家属于本店商品</option>

        {html_options options=$suppliers_list_name selected=$goods.suppliers_id}

      </select></td>

          </tr>

         {/if}

		 

		 <tr>

            <td class="label">产品标签：</td>

            <td>

          <input type="text" name="lab_qgby" id="lab_qgby" value="{$goods.lab_qgby}" />

        <input type="text" name="lab_zpbz" id="lab_zpbz" value="{$goods.lab_zpbz}" />

        <input type="text" name="lab_qtth" id="lab_qtth" value="{$goods.lab_qtth}" />

        <input type="text" name="lab_jkbs" id="lab_jkbs" value="{$goods.lab_jkbs}" />

        <input type="text" name="lab_hwzy" id="lab_hwzy" value="{$goods.lab_hwzy}" />

        </td>

          </tr> 

          <tr>

            <td class="label">产品特色：</td>

            <td>

          <input type="text" name="ts_a" id="ts_a" value="{$goods.ts_a}" />

        <input type="text" name="ts_b" id="ts_b" value="{$goods.ts_b}" />

        <input type="text" name="ts_c" id="ts_c" value="{$goods.ts_c}" />

        </td>

          </tr>  

          <tr>

            <td class="label">{$lang.lab_intro}</td>

            <td>

              <input type="checkbox" name="is_best" value="1" {if $goods.is_best}checked="checked"{/if} />{$lang.is_best} 

              <input type="checkbox" name="is_new" value="1" {if $goods.is_new}checked="checked"{/if} />{$lang.is_new} 

              <input type="checkbox" name="is_hot" value="1" {if $goods.is_hot}checked="checked"{/if} />{$lang.is_hot}

              <input type="checkbox" name="is_tejia" value="1" {if $goods.is_tejia eq 1}checked{/if}>特价

              

              <input type="checkbox" name="is_fresh" value="1" {if $goods.is_fresh eq 1}checked{/if}>新人专享

            </td>

          </tr>

          <!-- 

          <tr>

            <td class="label">选择商家</td>

            <td>

            <select name="suppliers_id">

            <option value="">请选择商家</option>

            {html_options options=$suppliers_list_name selected=$goods.suppliers_id}

            {$lang.require_field}

            </select>

            </td>

          </tr> -->

     <!--     <tr>

            <td class="label">{$lang.lab_other_cat}</td>

            <td>

              <input type="button" value="{$lang.add}" onclick="addOtherCat(this.parentNode)" class="button" />

              {foreach from=$goods.other_cat item=cat_id}

              <select name="other_cat[]"><option value="0">{$lang.select_please}</option>{$other_cat_list.$cat_id}</select>

              {/foreach}

            </td>

          </tr>-->
           <script>
          function clearBox(index){
                J_1 = document.getElementById('J_check1');
                J_2 = document.getElementById('J_check2');
                J_3 = document.getElementById('J_check3');
                switch(index){
                    
                    case 1:
                    J_2.checked=false;
                    J_3.checked=false;
                    break;
                    
                    case 2:
                    J_1.checked=false;
                    J_3.checked=false;
                    break;
                    
                    case 3:
                    J_1.checked=false;
                    J_2.checked=false;
                    break;
                }
          }
          </script>  
          <tr>

            <td class="label">销售方式：</td>

            <td>

              <input type="checkbox" id="J_check1" onclick="clearBox(1)" name="is_mall" value="1" {if $goods.is_mall eq 1}checked{/if}>单独购

              

              <input type="checkbox" id="J_check2" onclick="clearBox(2)" name="is_team" value="1" {if $goods.is_team eq 1}checked{/if}>拼团



              <input type="checkbox" id="J_check3" onclick="clearBox(3)" name="is_zero" value="1" {if $goods.is_zero eq 1}checked{/if}>零元购
              <font color="red">单独购、拼团、零元购只能三选一</font>

            </td>

          </tr>          

          <tr>

            <td class="label">{$lang.lab_shop_price}</td>

            <td><input type="text" name="shop_price" value="{$goods.shop_price}" size="20" onblur="priceSetted()"/>

            <input type="button" value="{$lang.compute_by_mp}" onclick="marketPriceSetted()" />

            {$lang.require_field}</td>

          </tr>

     

          <tr>

            <td class="label">{$lang.lab_market_price}</td>

            <td><input type="text" name="market_price" value="{$goods.market_price}" size="20" />

              <input type="button" value="{$lang.integral_market_price}" onclick="integral_market_price()" />

            </td>

          </tr>

          <tr>

            <td class="label">0元购邮费：</td>

            <td><input type="text" name="shipping_fee" value="{$goods.shipping_fee}" size="20" />

            </td>

          </tr>          

          <tr>

            <td class="label">是否允许使用优惠券：</td>

            <td>

                <label><input type="radio" name="bonus_allowed" value="1"{if $goods.bonus_allowed neq 0}checked='checked'{/if}>是</label>

                <label><input type="radio" name="bonus_allowed" value="0"{if $goods.bonus_allowed eq 0}checked='checked'{/if}>否</label>

            </td>

          </tr>

        <tr>

            <td class="label">是否允许分销：</td>

            <td>

                <label><input type="radio" name="allow_fenxiao" value="1"{if $goods.allow_fenxiao neq 0}checked='checked'{/if} onclick="document.getElementById('fenxiao_row').style.display = ''">是</label>

                <label><input type="radio" name="allow_fenxiao" value="0"{if $goods.allow_fenxiao eq 0}checked='checked'{/if} onclick="document.getElementById('fenxiao_row').style.display = 'none'">否</label>

            </td>

          </tr>                

          <tr id="fenxiao_row">

            <td class="label">分销金额：</td>

            <td>

                一级<input type="text" name="rate_1" value="{$goods.rate_1|default:0}">

                二级<input type="text" name="rate_2" value="{$goods.rate_2|default:0}">

                三级<input type="text" name="rate_3" value="{$goods.rate_3|default:0}">

            </td>

          </tr>                   



          <tr name="team_discount">

            <td class="label">团购价格：</td>

            <td><input type="text" name="team_price" value="{$goods.team_price}" size="20" />

            {$lang.require_field}</td>

          </tr>

         <tr name="team_discount">

            <td class="label">是否显示附近的团：</td>

            <td>

              <input type="radio" name="is_nearby" value="1" {if $goods.is_nearby eq 1}checked="checked"{/if}>是

              <input type="radio" name="is_nearby" value="0" {if $goods.is_nearby eq 0}checked="checked"{/if}>否

            </td>

          </tr>

          <tr name="team_discount">

            <td class="label">参团人数：</td>

            <td><input type="text" name="team_num" value="{if $form_act eq 'insert'}5{else}{$goods.team_num}{/if}" size="20" />

             {$lang.require_field}</td>

          </tr>

          <tr name="team_discount">

            <td class="label">团购销量：</td>

            <td><input type="text" name="sales_num" value="{$goods.sales_num}" size="20" /></td>

          </tr>

           <tr name="team_discount">

            <td class="label">团购限购数量：</td>

            <td><input type="text" name="limit_buy_bumber" value="{$goods.limit_buy_bumber}" size="20" /> 如果是团购请设置，为0表示不限购，如果是团长免单或团长优惠请确认是否要限制购买次数</td>

          </tr>

            <tr name="team_discount">

            <td class="label">团购限制次数;</td>

            <td><input type="radio" name="limit_buy_one" value="1" {if $goods.limit_buy_one eq 1}checked="checked"{/if}>是

              <input type="radio" name="limit_buy_one" value="0" {if $goods.limit_buy_one eq 0}checked="checked"{/if}>否 &nbsp;一个会员只能购买一次

            </td>

          </tr>

      <tr name="team_discount">

            <td class="label">团长优惠：</td>

            <td>

              <select name="discount_type" onchange="change_discount_type(this.value)">

                  <option value="0">无优惠</option>

                  <option value="1" {if $goods.discount_type eq 1}selected='selected'{/if}>团长免单</option>

                  <option value="2" {if $goods.discount_type eq 2}selected='selected'{/if}>团长优惠</option>

                </select>

                <span {if $goods.discount_type neq 2}style="display:none;"{/if} id="discount_amount">

                优惠金额：<input type="text"  name="discount_amount" value="{$goods.discount_amount}" onblur="discount_amount_blur(this.value)" >

                </span>

            </td>

          </tr>
          
          
                  <tr>

            <td class="label">秒杀产品：</td>

            <td>

                <label><input type="radio" name="is_miao" onclick="jianting(1);" value="1"{if $goods.is_miao neq 0}checked='checked'{/if}>是</label>

                <label><input type="radio" name="is_miao" onclick="jianting(0);" value="0"{if $goods.is_miao eq 0}checked='checked'{/if}>否</label>  <font color="red">和夺宝产品只能二选一,秒杀必须是单独购</font>

            </td>

          </tr>





          <script type="text/javascript">

              function jianting(is_miao){

                  if(is_miao==1){

                        $('#show , #promote_4').css('display','');

                    }

                    else{

                        $('#show , #promote_4').css('display','none');

                    }

                }



              function jian_tingluck(is_luck){

                  if(is_luck==1){

                        $('.show').css('display','');

                    }

                    else{

                        $('.show').css('display','none');

                    }

                }

          </script>





          <tr id="show" {if $goods.is_miao eq 0 or $goods.is_miao eq ''} style="display:none;"{/if}>

            <td class="label">秒杀价格：</td>

            <td>

                <input type="text" name="promote_price" value="{$goods.promote_price|default:0.00}">

            </td>

          </tr>          

          <tr id="promote_4" {if $goods.is_miao eq 0 or $goods.is_miao eq ''} style="display:none;"{/if}>

            <td class="label">秒杀时间</td>

            <td id="promote_6" >

              <input name="promote_start_date" type="text" id="promote_start_date" size="25" value='{$goods.promote_start_date}' readonly="readonly" onfocus="WdatePicker({dateFmt:'yyyy-M-d HH:mm'})" />

               - 

               <input name="promote_end_date" type="text" id="promote_end_date" size="25" value='{$goods.promote_end_date}' readonly="readonly" onfocus="WdatePicker({dateFmt:'yyyy-M-d HH:mm'})" /> <font color="red">*</font>

            </td>

          </tr>


         <tr>

            <td class="label">是否关注后购买:</td>

            <td>

            <input type="radio" name="subscribe" value="0" {if $goods.subscribe eq 0}checked="checked"{/if}>否 

            <input type="radio" name="subscribe" value="1" {if $goods.subscribe eq 1}checked="checked"{/if}>是 &nbsp;若选择是，必须是关注的会员才能购买,记得去系统设置/商店设置上传公众号二维码或引导链接

            </td>

          </tr>

          

          {if $user_rank_list}

         <!-- <tr>

            <td class="label">{$lang.lab_user_price}</td>

            <td>

              {foreach from=$user_rank_list item=user_rank}

              {$user_rank.rank_name}<span id="nrank_{$user_rank.rank_id}"></span><input type="text" id="rank_{$user_rank.rank_id}" name="user_price[]" value="{$member_price_list[$user_rank.rank_id]|default:-1}" onkeyup="if(parseInt(this.value)<-1){this.value='-1';};set_price_note({$user_rank.rank_id})" size="8" />

              <input type="hidden" name="user_rank[]" value="{$user_rank.rank_id}" />

              {/foreach}

              <span class="notice-span" id="noticeUserPrice">{$lang.notice_user_price}</span>

            </td>

          </tr>-->

          {/if}



          <!--鍟嗗搧浼樻儬浠锋牸-->

      <!--    <tr>

            <td class="label">{$lang.lab_volume_price}</td>

            <td>

              <table width="100%" id="tbody-volume" align="center">

                {foreach from=$volume_price_list item=volume_price name="volume_price_tab"}

                <tr>

                  <td>

                     {if $smarty.foreach.volume_price_tab.iteration eq 1}

                       <a href="javascript:;" onclick="addVolumePrice(this)">[+]</a>

                     {else}

                       <a href="javascript:;" onclick="removeVolumePrice(this)">[-]</a>

                     {/if}

                     {$lang.volume_number} <input type="text" name="volume_number[]" size="8" value="{$volume_price.number}"/>

                     {$lang.volume_price} <input type="text" name="volume_price[]" size="8" value="{$volume_price.price}"/>

                  </td>

                </tr>

                {/foreach}

              </table>

              <span class="notice-span" id="volumePrice">{$lang.notice_volume_price}</span>

            </td>

          </tr>-->

          <!--鍟嗗搧浼樻儬浠锋牸 end -->



    

          <tr>

            <td class="label">{$lang.lab_picture}</td>

            <td>

              <input type="file" name="goods_img" size="35" />

              {if $goods.goods_img}

                <a href="goods.php?act=show_image&img_url={$goods.goods_img}" target="_blank"><img src="images/yes.gif" border="0" /></a>

              {else}

                <img src="images/no.gif" />

              {/if}

              规格：1:1正方形（建议：400*400 像素） {$lang.require_field}

            </td>

          </tr>

          <tr id="auto_thumb_1">

            <td class="label"> {$lang.lab_thumb}</td>

            <td id="auto_thumb_3">

              <input type="file" name="goods_thumb" size="35" />

              {if $goods.goods_thumb}

                <a href="goods.php?act=show_image&img_url={$goods.goods_thumb}" target="_blank"><img src="images/yes.gif" border="0" /></a>

              {else}

                <img src="images/no.gif" />

              {/if}

              <br /><input type="text" size="40" value="{$lang.lab_thumb_url}" style="color:#aaa;" onfocus="if (this.value == '{$lang.lab_thumb_url}'){this.value='http://';this.style.color='#000';}" name="goods_thumb_url"/>

              {if $gd > 0}

              <br /><label for="auto_thumb"><input type="checkbox" id="auto_thumb" name="auto_thumb" checked="true" value="1" onclick="handleAutoThumb(this.checked)" />{$lang.auto_thumb}</label>{/if}

            </td>

          </tr>

          <tr>

            <td class="label">拼团矩形图</td>

            <td>

              <input type="file" name="little_img" size="35" />

              {if $goods.little_img}

                <a href="goods.php?act=show_image&img_url={$goods.little_img}" target="_blank"><img src="images/yes.gif" border="0" /></a>

              {else}

                <img src="images/no.gif" />

              {/if}

              规格：640*400 像素 {$lang.require_field}

            </td>

          </tr>

          

        </table>



        <!-- 璇︾粏鎻忚堪 -->

        <table width="90%" id="detail-table" style="display:none">

          <tr>

            <td>{$FCKeditor}</td>

          </tr>

        </table>



        <!-- 鍏朵粬淇℃伅 -->

        <table width="90%" id="mix-table" style="display:none" align="center">

          {if $code eq ''}

          <tr>

            <td class="label">{$lang.lab_goods_weight}</td> 

            <td><input type="text" name="goods_weight" value="{$goods.goods_weight_by_unit}" size="20" /> <select name="weight_unit">{html_options options=$unit_list selected=$weight_unit}</select></td>

          </tr>

          {/if}

          {if $cfg.use_storage}

          <tr>

            <td class="label">{$lang.lab_goods_number}</td>

<!--            <td><input type="text" name="goods_number" value="{$goods.goods_number}" size="20" {if $code neq '' || $goods._attribute neq ''}readonly="readonly"{/if} /><br />-->

            <td><input type="text" name="goods_number" value="{$goods.goods_number}" size="20" />

            <span class="notice-span" id="noticeStorage">{$lang.notice_storage}</span></td>

          </tr>

          <tr>

            <td class="label">{$lang.lab_warn_number}</td>

            <td><input type="text" name="warn_number" value="{$goods.warn_number}" size="20" /></td>

          </tr>

          {/if}

      <!--    <tr>

            <td class="label">{$lang.lab_intro}</td>

            <td><input type="checkbox" name="is_best" value="1" {if $goods.is_best}checked="checked"{/if} />{$lang.is_best} <input type="checkbox" name="is_new" value="1" {if $goods.is_new}checked="checked"{/if} />{$lang.is_new} <input type="checkbox" name="is_hot" value="1" {if $goods.is_hot}checked="checked"{/if} />{$lang.is_hot}</td>

          </tr>-->

          <tr id="alone_sale_1">

            <td class="label" id="alone_sale_2">{$lang.lab_is_on_sale}</td>

            <td id="alone_sale_3"><input type="checkbox" name="is_on_sale" value="1" {if $goods.is_on_sale}checked="checked"{/if} /> {$lang.on_sale_desc}</td>

          </tr>

           <tr>

            <td class="label">{$lang.lab_intro}</td>

            <td><input type="checkbox" name="is_best" value="1" {if $goods.is_best}checked="checked"{/if} />{$lang.is_best} <input type="checkbox" name="is_new" value="1" {if $goods.is_new}checked="checked"{/if} />{$lang.is_new} <input type="checkbox" name="is_hot" value="1" {if $goods.is_hot}checked="checked"{/if} />{$lang.is_hot}</td>

          </tr>

       <!--   <tr>

            <td class="label">{$lang.lab_is_alone_sale}</td>

            <td><input type="checkbox" name="is_alone_sale" value="1" {if $goods.is_alone_sale}checked="checked"{/if} /> {$lang.alone_sale}</td>

          </tr>-->

       <!--   <tr>

            <td class="label">{$lang.lab_is_free_shipping}</td>

            <td><input type="checkbox" name="is_shipping" value="1" {if $goods.is_shipping}checked="checked"{/if} /> {$lang.free_shipping}</td>

          </tr>-->

          <tr>

            <td class="label">{$lang.lab_keywords}</td>

            <td><input type="text" name="keywords" value="{$goods.keywords|escape}" size="40" /> {$lang.notice_keywords}</td>

          </tr>

<!--           <tr>

            <td class="label">{$lang.lab_goods_brief}</td>

            <td><textarea name="goods_brief" cols="40" rows="3">{$goods.goods_brief|escape}</textarea></td>

          </tr> -->

          <tr>

            <td class="label">

            {$lang.lab_seller_note} </td>

            <td><textarea name="seller_note" cols="40" rows="3">{$goods.seller_note}</textarea>

            <span class="notice-span" id="noticeSellerNote">{$lang.notice_seller_note}</span></td>

          </tr>

        </table>



        <!-- 灞炴€т笌瑙勬牸 -->

        {if $goods_type_list}

        <table width="90%" id="properties-table" style="display:none" align="center">

          <tr>

              <td class="label">{$lang.lab_goods_type}</td>

              <td>

                <select name="goods_type" onchange="getAttrList({$goods.goods_id})">

                  <option value="0">{$lang.sel_goods_type}</option>

                  {$goods_type_list}

                </select>>

              <span class="notice-span" id="noticeGoodsType">{$lang.notice_goods_type}</span></td>

          </tr>

          <tr>

            <td id="tbody-goodsAttr" colspan="2" style="padding:0">{$goods_attr_html}</td>

          </tr>

        </table>

        {/if}



        <!-- 鍟嗗搧鐩稿唽 -->

        <table width="90%" id="gallery-table" style="display:none" align="center">

          <!-- 鍥剧墖鍒楄〃 -->

          <tr>

            <td>规格：1:1正方形（建议：600*600 像素）</td>

          </tr>

          <tr>

            <td>

              {foreach from=$img_list item=img key=i}

              <div id="gallery_{$img.img_id}" style="float:left; text-align:center; border: 1px solid #DADADA; margin: 4px; padding:2px;">

                <a href="javascript:;" onclick="if (confirm('{$lang.drop_img_confirm}')) dropImg('{$img.img_id}')">[-]</a><br />

                <a href="goods.php?act=show_image&img_url={$img.img_url}" target="_blank">

                <img src="../{if $img.thumb_url}{$img.thumb_url}{else}{$img.img_url}{/if}" {if $thumb_width neq 0}width="{$thumb_width}"{/if} {if $thumb_height neq 0}height="{$thumb_height}"{/if} border="0" />

                </a><br />

                <input type="text" value="{$img.img_desc|escape}" size="15" name="old_img_desc[{$img.img_id}]" />

              </div>

              {/foreach}

            </td>

          </tr>

          <tr><td>&nbsp;</td></tr>

          <!-- 涓婁紶鍥剧墖 -->

          <tr>

            <td>

              <a href="javascript:;" onclick="addImg(this)">[+]</a>

              {$lang.img_desc} <input type="text" name="img_desc[]" size="20" />

              {$lang.img_url} <input type="file" name="img_url[]" />

              <input type="text" size="40" value="{$lang.img_file}" style="color:#aaa;" onfocus="if (this.value == '{$lang.img_file}'){this.value='http://';this.style.color='#000';}" name="img_file[]"/>

            </td>

          </tr>

        </table>



        <!-- 鍏宠仈鍟嗗搧 -->

        <table width="90%" id="linkgoods-table" style="display:none" align="center">

          <!-- 鍟嗗搧鎼滅储 -->

          <tr>

            <td colspan="3">

              <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />

              <select name="cat_id1"><option value="0">{$lang.all_category}{$cat_list}</select>

              <select name="brand_id1"><option value="0">{$lang.all_brand}{html_options options=$brand_list}</select>

              <input type="text" name="keyword1" />

              <input type="button" value="{$lang.button_search}"  class="button"

                onclick="searchGoods(sz1, 'cat_id1','brand_id1','keyword1')" />

            </td>

          </tr>

          <!-- 鍟嗗搧鍒楄〃 -->

          <tr>

            <th>{$lang.all_goods}</th>

            <th>{$lang.handler}</th>

            <th>{$lang.link_goods}</th>

          </tr>

          <tr>

            <td width="42%">

              <select name="source_select1" size="20" style="width:100%" ondblclick="sz1.addItem(false, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" multiple="true">

              </select>

            </td>

            <td align="center">

              <p><input name="is_single" type="radio" value="1" checked="checked" />{$lang.single}<br /><input name="is_single" type="radio" value="0" />{$lang.double}</p>

              <p><input type="button" value=">>" onclick="sz1.addItem(true, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" class="button" /></p>

              <p><input type="button" value=">" onclick="sz1.addItem(false, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" class="button" /></p>

              <p><input type="button" value="<" onclick="sz1.dropItem(false, 'drop_link_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>

              <p><input type="button" value="<<" onclick="sz1.dropItem(true, 'drop_link_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>

            </td>

            <td width="42%">

              <select name="target_select1" size="20" style="width:100%" multiple ondblclick="sz1.dropItem(false, 'drop_link_goods', goodsId, elements['is_single'][0].checked)">

                {foreach from=$link_goods_list item=link_goods}

                <option value="{$link_goods.goods_id}">{$link_goods.goods_name}</option>

                {/foreach}

              </select>

            </td>

          </tr>

        </table>



        <!-- 閰嶄欢 -->

        <table width="90%" id="groupgoods-table" style="display:none" align="center">

          <!-- 鍟嗗搧鎼滅储 -->

          <tr>

            <td colspan="3">

              <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />

              <select name="cat_id2"><option value="0">{$lang.all_category}{$cat_list}</select>

              <select name="brand_id2"><option value="0">{$lang.all_brand}{html_options options=$brand_list}</select>

              <input type="text" name="keyword2" />

              <input type="button" value="{$lang.button_search}" onclick="searchGoods(sz2, 'cat_id2', 'brand_id2', 'keyword2')" class="button" />

            </td>

          </tr>

          <!-- 鍟嗗搧鍒楄〃 -->

          <tr>

            <th>{$lang.all_goods}</th>

            <th>{$lang.handler}</th>

            <th>{$lang.group_goods}</th>

          </tr>

          <tr>

            <td width="42%">

              <select name="source_select2" size="20" style="width:100%" onchange="sz2.priceObj.value = this.options[this.selectedIndex].id" ondblclick="sz2.addItem(false, 'add_group_goods', goodsId, this.form.elements['price2'].value)">

              </select>

            </td>

            <td align="center">

              <p>{$lang.price}<br /><input name="price2" type="text" size="6" /></p>

              <p><input type="button" value=">" onclick="sz2.addItem(false, 'add_group_goods', goodsId, this.form.elements['price2'].value)" class="button" /></p>

              <p><input type="button" value="<" onclick="sz2.dropItem(false, 'drop_group_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>

              <p><input type="button" value="<<" onclick="sz2.dropItem(true, 'drop_group_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>

            </td>

            <td width="42%">

              <select name="target_select2" size="20" style="width:100%" multiple ondblclick="sz2.dropItem(false, 'drop_group_goods', goodsId, elements['is_single'][0].checked)">

                {foreach from=$group_goods_list item=group_goods}

                <option value="{$group_goods.goods_id}">{$group_goods.goods_name}</option>

                {/foreach}

              </select>

            </td>

          </tr>

        </table>



        <!-- 鍏宠仈鏂囩珷 -->

        <table width="90%" id="article-table" style="display:none" align="center">

          <!-- 鏂囩珷鎼滅储 -->

          <tr>

            <td colspan="3">

              <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />

              {$lang.article_title} <input type="text" name="article_title" />

              <input type="button" value="{$lang.button_search}" onclick="searchArticle()" class="button" />

            </td>

          </tr>

          <!-- 鏂囩珷鍒楄〃 -->

          <tr>

            <th>{$lang.all_article}</th>

            <th>{$lang.handler}</th>

            <th>{$lang.goods_article}</th>

          </tr>

          <tr>

            <td width="45%">

              <select name="source_select3" size="20" style="width:100%" multiple ondblclick="sz3.addItem(false, 'add_goods_article', goodsId, this.form.elements['price2'].value)">

              </select>

            </td>

            <td align="center">

              <p><input type="button" value=">>" onclick="sz3.addItem(true, 'add_goods_article', goodsId, this.form.elements['price2'].value)" class="button" /></p>

              <p><input type="button" value=">" onclick="sz3.addItem(false, 'add_goods_article', goodsId, this.form.elements['price2'].value)" class="button" /></p>

              <p><input type="button" value="<" onclick="sz3.dropItem(false, 'drop_goods_article', goodsId, elements['is_single'][0].checked)" class="button" /></p>

              <p><input type="button" value="<<" onclick="sz3.dropItem(true, 'drop_goods_article', goodsId, elements['is_single'][0].checked)" class="button" /></p>

            </td>

            <td width="45%">

              <select name="target_select3" size="20" style="width:100%" multiple ondblclick="sz3.dropItem(false, 'drop_goods_article', goodsId, elements['is_single'][0].checked)">

                {foreach from=$goods_article_list item=goods_article}

                <option value="{$goods_article.article_id}">{$goods_article.title}</option>

                {/foreach}

              </select>

            </td>

          </tr>

        </table>



        <div class="button-div">

          <input type="hidden" name="goods_id" value="{$goods.goods_id}" />

          {if $code neq ''}

          <input type="hidden" name="extension_code" value="{$code}" />

          {/if}

          <input type="submit" value="{$lang.button_submit}" class="button"  />

          <input type="reset" value="{$lang.button_reset}" class="button" />

        </div>
<input type="hidden" name="page" value="{$page}" />
        <input type="hidden" name="act" value="{$form_act}" />

      </form>

    </div>

</div>

<!-- end goods form -->

{insert_scripts files="validator.js,tab.js"}



<script language="JavaScript">

  region.isAdmin = true;



  var goodsId = '{$goods.goods_id}';

  var elements = document.forms['theForm'].elements;

  var sz1 = new SelectZone(1, elements['source_select1'], elements['target_select1']);

  var sz2 = new SelectZone(2, elements['source_select2'], elements['target_select2'], elements['price2']);

  var sz3 = new SelectZone(1, elements['source_select3'], elements['target_select3']);

  var marketPriceRate = {$cfg.market_price_rate|default:1};

  var integralPercent = {$cfg.integral_percent|default:0};



  {literal}

  onload = function()

  {

     



      if (document.forms['theForm'].elements['auto_thumb'])

      {

          handleAutoThumb(document.forms['theForm'].elements['auto_thumb'].checked);

      }



      // 妫€鏌ユ柊璁㈠崟

      startCheckOrder();

      {/literal}

      {foreach from=$user_rank_list item=item}

      set_price_note({$item.rank_id});

      {/foreach}

      {literal}

      document.forms['theForm'].reset();

  }



  function validate(goods_id)

  {

      var validator = new Validator('theForm');

      var goods_sn  = document.forms['theForm'].elements['goods_sn'].value;



      validator.required('goods_name', goods_name_not_null);

      if (document.forms['theForm'].elements['cat_id'].value == 0)

      {

          validator.addErrorMsg(goods_cat_not_null);

      }



      checkVolumeData("1",validator);



      validator.required('shop_price', shop_price_not_null);

      validator.isNumber('shop_price', shop_price_not_number, true);



      if (document.forms['theForm'].elements['is_team'].checked == true)

      {

        document.forms['theForm'].elements['is_zero'].checked = false

        validator.required('team_num', '参团人数不能为空');

        validator.isNumber('team_num', '参团人数必须是数值', true);

        validator.required('team_price', '团购价格不能为空');

        validator.isNumber('team_price', '团购价格必须是数值', true);



        if (document.forms['theForm'].elements['team_num'].value < 2)

        {

            validator.addErrorMsg('参团人数不能小于2');

        }

      }

      if (document.forms['theForm'].elements['is_zero'].checked == true)

      {

          document.forms['theForm'].elements['is_team'].checked = false

          document.forms['theForm'].elements['team_num'].value = 0

          document.forms['theForm'].elements['team_price'].value = 0.00

      }

      

      validator.isNumber('market_price', market_price_not_number, false);

     // if (document.forms['theForm'].elements['is_promote'].checked)

//      {

//          validator.required('promote_start_date', promote_start_not_null);

//          validator.required('promote_end_date', promote_end_not_null);

//          validator.islt('promote_start_date', 'promote_end_date', promote_not_lt);

//      }



      if (document.forms['theForm'].elements['goods_number'] != undefined)

      {

          validator.isInt('goods_number', goods_number_not_int, false);

          validator.isInt('warn_number', warn_number_not_int, false);

      }

      

      var callback = function(res)

      {  

        if (res.error > 0)

        {

          alert("{$lang.goods_sn_exists}");

        }

        else

        {

           if(validator.passed())

           {

            document.forms['theForm'].submit();

           }

        }

    }

     

      return validator.passed();

    //Ajax.call('goods.php?is_ajax=1&act=check_goods_sn', "goods_sn=" + goods_sn + "&goods_id=" + goods_id, callback , "GET", "JSON");

}





  /**

   * 鍒囨崲鍟嗗搧绫诲瀷

   */

  function getAttrList(goodsId)

  {

      var selGoodsType = document.forms['theForm'].elements['goods_type'];



      if (selGoodsType != undefined)

      {

          var goodsType = selGoodsType.options[selGoodsType.selectedIndex].value;



          Ajax.call('goods.php?is_ajax=1&act=get_attr', 'goods_id=' + goodsId + "&goods_type=" + goodsType, setAttrList, "GET", "JSON");

      }

  }



  function setAttrList(result, text_result)

  {

    document.getElementById('tbody-goodsAttr').innerHTML = result.content;

  }



  /**

   * 鎸夋瘮渚嬭?绠椾环鏍

   * @param   string  inputName   杈撳叆妗嗗悕绉

   * @param   float   rate        姣斾緥

   * @param   string  priceName   浠锋牸杈撳叆妗嗗悕绉帮紙濡傛灉娌℃湁锛屽彇shop_price锛

   */

  function computePrice(inputName, rate, priceName)

  {

      var shopPrice = priceName == undefined ? document.forms['theForm'].elements['shop_price'].value : document.forms['theForm'].elements[priceName].value;

      shopPrice = Utils.trim(shopPrice) != '' ? parseFloat(shopPrice)* rate : 0;

      if(inputName == 'integral')

      {

          shopPrice = parseInt(shopPrice);

      }

      shopPrice += "";



      n = shopPrice.lastIndexOf(".");

      if (n > -1)

      {

          shopPrice = shopPrice.substr(0, n + 3);

      }



      if (document.forms['theForm'].elements[inputName] != undefined)

      {

          document.forms['theForm'].elements[inputName].value = shopPrice;

      }

      else

      {

          document.getElementById(inputName).value = shopPrice;

      }

  }



  /**

   * 璁剧疆浜嗕竴涓?晢鍝佷环鏍硷紝鏀瑰彉甯傚満浠锋牸銆佺Н鍒嗕互鍙婁細鍛樹环鏍

   */

  function priceSetted()

  {

    computePrice('market_price', marketPriceRate);

    computePrice('integral', integralPercent / 100);

    {/literal}

    {foreach from=$user_rank_list item=item}

    set_price_note({$item.rank_id});

    {/foreach}

    {literal}

  }



  /**

   * 璁剧疆浼氬憳浠锋牸娉ㄩ噴

   */

  function set_price_note(rank_id)

  {

    var shop_price = parseFloat(document.forms['theForm'].elements['shop_price'].value);



    var rank = new Array();

    {/literal}

    {foreach from=$user_rank_list item=item}

    rank[{$item.rank_id}] = {$item.discount|default:100};

    {/foreach}

    {literal}

    if (shop_price >0 && rank[rank_id] && document.getElementById('rank_' + rank_id) && parseInt(document.getElementById('rank_' + rank_id).value) == -1)

    {

      var price = parseInt(shop_price * rank[rank_id] + 0.5) / 100;

      if (document.getElementById('nrank_' + rank_id))

      {

        document.getElementById('nrank_' + rank_id).innerHTML = '(' + price + ')';

      }

    }

    else

    {

      if (document.getElementById('nrank_' + rank_id))

      {

        document.getElementById('nrank_' + rank_id).innerHTML = '';

      }

    }

  }



  /**

   * 鏍规嵁甯傚満浠锋牸锛岃?绠楀苟鏀瑰彉鍟嗗簵浠锋牸銆佺Н鍒嗕互鍙婁細鍛樹环鏍

   */

  function marketPriceSetted()

  {

    computePrice('shop_price', 1/marketPriceRate, 'market_price');

    computePrice('integral', integralPercent / 100);

    {/literal}

    {foreach from=$user_rank_list item=item}

    set_price_note({$item.rank_id});

    {/foreach}

    {literal}

  }



  /**

   * 鏂板?涓€涓??鏍

   */

  function addSpec(obj)

  {

      var src   = obj.parentNode.parentNode;

      var idx   = rowindex(src);

      var tbl   = document.getElementById('attrTable');

      var row   = tbl.insertRow(idx + 1);

      var cell1 = row.insertCell(-1);

      var cell2 = row.insertCell(-1);

      var regx  = /<a([^>]+)<\/a>/i;



      cell1.className = 'label';

      cell1.innerHTML = src.childNodes[0].innerHTML.replace(/(.*)(addSpec)(.*)(\[)(\+)/i, "$1removeSpec$3$4-");

      cell2.innerHTML = src.childNodes[1].innerHTML.replace(/readOnly([^\s|>]*)/i, '');

  }



  /**

   * 鍒犻櫎瑙勬牸鍊

   */

  function removeSpec(obj)

  {

      var row = rowindex(obj.parentNode.parentNode);

      var tbl = document.getElementById('attrTable');



      tbl.deleteRow(row);

  }



  /**

   * 澶勭悊瑙勬牸

   */

  function handleSpec()

  {

      var elementCount = document.forms['theForm'].elements.length;

      for (var i = 0; i < elementCount; i++)

      {

          var element = document.forms['theForm'].elements[i];

          if (element.id.substr(0, 5) == 'spec_')

          {

              var optCount = element.options.length;

              var value = new Array(optCount);

              for (var j = 0; j < optCount; j++)

              {

                  value[j] = element.options[j].value;

              }



              var hiddenSpec = document.getElementById('hidden_' + element.id);

              hiddenSpec.value = value.join(String.fromCharCode(13)); // 鐢ㄥ洖杞﹂敭闅斿紑姣忎釜瑙勬牸

          }

      }

      return true;

  }



  function handlePromote(checked)

  {

      document.forms['theForm'].elements['promote_price'].disabled = !checked;

      document.forms['theForm'].elements['selbtn1'].disabled = !checked;

      document.forms['theForm'].elements['selbtn2'].disabled = !checked;

  }



  function handleAutoThumb(checked)

  {

      document.forms['theForm'].elements['goods_thumb'].disabled = checked;

      document.forms['theForm'].elements['goods_thumb_url'].disabled = checked;

  }



  /**

   * 蹇?€熸坊鍔犲搧鐗

   */

  function rapidBrandAdd(conObj)

  {

      var brand_div = document.getElementById("brand_add");



      if(brand_div.style.display != '')

      {

          var brand =document.forms['theForm'].elements['addedBrandName'];

          brand.value = '';

          brand_div.style.display = '';

      }

  }



  function hideBrandDiv()

  {

      var brand_add_div = document.getElementById("brand_add");

      if(brand_add_div.style.display != 'none')

      {

          brand_add_div.style.display = 'none';

      }

  }



  function goBrandPage()

  {

      if(confirm(go_brand_page))

      {

          window.location.href='brand.php?act=add';

      }

      else

      {

          return;

      }

  }



  function rapidCatAdd()

  {

      var cat_div = document.getElementById("category_add");



      if(cat_div.style.display != '')

      {

          var cat =document.forms['theForm'].elements['addedCategoryName'];

          cat.value = '';

          cat_div.style.display = '';

      }

  }



  function addBrand()

  {

      var brand = document.forms['theForm'].elements['addedBrandName'];

      if(brand.value.replace(/^\s+|\s+$/g, '') == '')

      {

          alert(brand_cat_not_null);

          return;

      }



      var params = 'brand=' + brand.value;

      Ajax.call('brand.php?is_ajax=1&act=add_brand', params, addBrandResponse, 'GET', 'JSON');

  }



  function addBrandResponse(result)

  {

      if (result.error == '1' && result.message != '')

      {

          alert(result.message);

          return;

      }



      var brand_div = document.getElementById("brand_add");

      brand_div.style.display = 'none';



      var response = result.content;



      var selCat = document.forms['theForm'].elements['brand_id'];

      var opt = document.createElement("OPTION");

      opt.value = response.id;

      opt.selected = true;

      opt.text = response.brand;



      if (Browser.isIE)

      {

          selCat.add(opt);

      }

      else

      {

          selCat.appendChild(opt);

      }



      return;

  }



  function addCategory()

  {

      var parent_id = document.forms['theForm'].elements['cat_id'];

      var cat = document.forms['theForm'].elements['addedCategoryName'];

      if(cat.value.replace(/^\s+|\s+$/g, '') == '')

      {

          alert(category_cat_not_null);

          return;

      }



      var params = 'parent_id=' + parent_id.value;

      params += '&cat=' + cat.value;

      Ajax.call('category.php?is_ajax=1&act=add_category', params, addCatResponse, 'GET', 'JSON');

  }



  function hideCatDiv()

  {

      var category_add_div = document.getElementById("category_add");

      if(category_add_div.style.display != null)

      {

          category_add_div.style.display = 'none';

      }

  }



  function addCatResponse(result)

  {

      if (result.error == '1' && result.message != '')

      {

          alert(result.message);

          return;

      }



      var category_add_div = document.getElementById("category_add");

      category_add_div.style.display = 'none';



      var response = result.content;



      var selCat = document.forms['theForm'].elements['cat_id'];

      var opt = document.createElement("OPTION");

      opt.value = response.id;

      opt.selected = true;

      opt.innerHTML = response.cat;



      //鑾峰彇瀛愬垎绫荤殑绌烘牸鏁

      var str = selCat.options[selCat.selectedIndex].text;

      var temp = str.replace(/^\s+/g, '');

      var lengOfSpace = str.length - temp.length;

      if(response.parent_id != 0)

      {

          lengOfSpace += 4;

      }

      for (i = 0; i < lengOfSpace; i++)

      {

          opt.innerHTML = '&nbsp;' + opt.innerHTML;

      }



      for (i = 0; i < selCat.length; i++)

      {

          if(selCat.options[i].value == response.parent_id)

          {

              if(i == selCat.length)

              {

                  if (Browser.isIE)

                  {

                      selCat.add(opt);

                  }

                  else

                  {

                      selCat.appendChild(opt);

                  }

              }

              else

              {

                  selCat.insertBefore(opt, selCat.options[i + 1]);

              }

              //opt.selected = true;

              break;

          }



      }



      return;

  }



    function goCatPage()

    {

        if(confirm(go_category_page))

        {

            window.location.href='category.php?act=add';

        }

        else

        {

            return;

        }

    }





  /**

   * 鍒犻櫎蹇?€熷垎绫

   */

  function removeCat()

  {

      if(!document.forms['theForm'].elements['parent_cat'] || !document.forms['theForm'].elements['new_cat_name'])

      {

          return;

      }



      var cat_select = document.forms['theForm'].elements['parent_cat'];

      var cat = document.forms['theForm'].elements['new_cat_name'];



      cat.parentNode.removeChild(cat);

      cat_select.parentNode.removeChild(cat_select);

  }



  /**

   * 鍒犻櫎蹇?€熷搧鐗

   */

  function removeBrand()

  {

      if (!document.forms['theForm'].elements['new_brand_name'])

      {

          return;

      }



      var brand = document.theForm.new_brand_name;

      brand.parentNode.removeChild(brand);

  }



  /**

   * 娣诲姞鎵╁睍鍒嗙被

   */

  function addOtherCat(conObj)

  {

      var sel = document.createElement("SELECT");

      var selCat = document.forms['theForm'].elements['cat_id'];



      for (i = 0; i < selCat.length; i++)

      {

          var opt = document.createElement("OPTION");

          opt.text = selCat.options[i].text;

          opt.value = selCat.options[i].value;

          if (Browser.isIE)

          {

              sel.add(opt);

          }

          else

          {

              sel.appendChild(opt);

          }

      }

      conObj.appendChild(sel);

      sel.name = "other_cat[]";

      sel.onChange = function() {checkIsLeaf(this);};

  }



  /* 鍏宠仈鍟嗗搧鍑芥暟 */

  function searchGoods(szObject, catId, brandId, keyword)

  {

      var filters = new Object;



      filters.cat_id = elements[catId].value;

      filters.brand_id = elements[brandId].value;

      filters.keyword = Utils.trim(elements[keyword].value);

      filters.exclude = document.forms['theForm'].elements['goods_id'].value;



      szObject.loadOptions('get_goods_list', filters);

  }



  /**

   * 鍏宠仈鏂囩珷鍑芥暟

   */

  function searchArticle()

  {

    var filters = new Object;



    filters.title = Utils.trim(elements['article_title'].value);



    sz3.loadOptions('get_article_list', filters);

  }



  /**

   * 鏂板?涓€涓?浘鐗

   */

  function addImg(obj)

  {

      var src  = obj.parentNode.parentNode;

      var idx  = rowindex(src);

      var tbl  = document.getElementById('gallery-table');

      var row  = tbl.insertRow(idx + 1);

      var cell = row.insertCell(-1);

      cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");

  }



  /**

   * 鍒犻櫎鍥剧墖涓婁紶

   */

  function removeImg(obj)

  {

      var row = rowindex(obj.parentNode.parentNode);

      var tbl = document.getElementById('gallery-table');



      tbl.deleteRow(row);

  }



  /**

   * 鍒犻櫎鍥剧墖

   */

  function dropImg(imgId)

  {

    Ajax.call('goods.php?is_ajax=1&act=drop_image', "img_id="+imgId, dropImgResponse, "GET", "JSON");

  }



  function dropImgResponse(result)

  {

      if (result.error == 0)

      {

          document.getElementById('gallery_' + result.content).style.display = 'none';

      }

  }



  /**

   * 灏嗗競鍦轰环鏍煎彇鏁

   */

  function integral_market_price()

  {

    document.forms['theForm'].elements['market_price'].value = parseInt(document.forms['theForm'].elements['market_price'].value);

  }



   /**

   * 灏嗙Н鍒嗚喘涔伴?搴﹀彇鏁

   */

  function parseint_integral()

  {

    document.forms['theForm'].elements['integral'].value = parseInt(document.forms['theForm'].elements['integral'].value);

  }





  /**

  * 妫€鏌ヨ揣鍙锋槸鍚﹀瓨鍦

  */

  function checkGoodsSn(goods_sn, goods_id)

  {

    if (goods_sn == '')

    {

        document.getElementById('goods_sn_notice').innerHTML = "";

        return;

    }



    var callback = function(res)

    {

      if (res.error > 0)

      {

        document.getElementById('goods_sn_notice').innerHTML = res.message;

        document.getElementById('goods_sn_notice').style.color = "red";

      }

      else

      {

        document.getElementById('goods_sn_notice').innerHTML = "";

      }

    }

    Ajax.call('goods.php?is_ajax=1&act=check_goods_sn', "goods_sn=" + goods_sn + "&goods_id=" + goods_id, callback, "GET", "JSON");

  }



  /**

   * 鏂板?涓€涓?紭鎯犱环鏍

   */

  function addVolumePrice(obj)

  {

    var src      = obj.parentNode.parentNode;

    var tbl      = document.getElementById('tbody-volume');



    var validator  = new Validator('theForm');

    checkVolumeData("0",validator);

    if (!validator.passed())

    {

      return false;

    }



    var row  = tbl.insertRow(tbl.rows.length);

    var cell = row.insertCell(-1);

    cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addVolumePrice)(.*)(\[)(\+)/i, "$1removeVolumePrice$3$4-");



    var number_list = document.getElementsByName("volume_number[]");

    var price_list  = document.getElementsByName("volume_price[]");



    number_list[number_list.length-1].value = "";

    price_list[price_list.length-1].value   = "";

  }



  /**

   * 鍒犻櫎浼樻儬浠锋牸

   */

  function removeVolumePrice(obj)

  {

    var row = rowindex(obj.parentNode.parentNode);

    var tbl = document.getElementById('tbody-volume');



    tbl.deleteRow(row);

  }



  /**

   * 鏍￠獙浼樻儬鏁版嵁鏄?惁姝ｇ‘

   */

  function checkVolumeData(isSubmit,validator)

  {

    var volumeNum = document.getElementsByName("volume_number[]");

    var volumePri = document.getElementsByName("volume_price[]");

    var numErrNum = 0;

    var priErrNum = 0;



    for (i = 0 ; i < volumePri.length ; i ++)

    {

      if ((isSubmit != 1 || volumeNum.length > 1) && numErrNum <= 0 && volumeNum.item(i).value == "")

      {

        validator.addErrorMsg(volume_num_not_null);

        numErrNum++;

      }



      if (numErrNum <= 0 && Utils.trim(volumeNum.item(i).value) != "" && ! Utils.isNumber(Utils.trim(volumeNum.item(i).value)))

      {

        validator.addErrorMsg(volume_num_not_number);

        numErrNum++;

      }



      if ((isSubmit != 1 || volumePri.length > 1) && priErrNum <= 0 && volumePri.item(i).value == "")

      {

        validator.addErrorMsg(volume_price_not_null);

        priErrNum++;

      }



      if (priErrNum <= 0 && Utils.trim(volumePri.item(i).value) != "" && ! Utils.isNumber(Utils.trim(volumePri.item(i).value)))

      {

        validator.addErrorMsg(volume_price_not_number);

        priErrNum++;

      }

    }

  }

  function change_discount_type(value){

    var theForm=document.forms['theForm'];

    if(value==2){

      

      var team_price=theForm.team_price.value;

      if(team_price==''){

        alert('请先填写团购价格');

        theForm.discount_type.value='0';

        theForm.team_price.focus();

        return ;

      } 

      document.getElementById('discount_amount').style.display='';

    }else{

      document.getElementById('discount_amount').style.display='none';

    }  

  }

  function discount_amount_blur(value){

    var theForm=document.forms['theForm'];

    var team_price=theForm.team_price.value;

    if(team_price==''){

      alert('请先填写团购价格');

      theForm.discount_type.value='0';

      theForm.team_price.focus();

      return ;

    } 

    if(value==''){

      alert('请先填写优惠价格');

      return ;

    }

    if(parseFloat(value)>=parseFloat(team_price)){

      alert('优惠价格不能大于等于团购价格');

      return ;

    }

    if(parseFloat(value)<=0){

      alert('优惠价格不能小于等于0');

      return ;

    }

  }  



  {/literal}

</script>

{include file="pagefooter.htm"}

